﻿using System;
using System.Collections.Generic;

namespace SLNGP.Common.Extensions
{
    public class LambdaEqualityComparer<T> : EqualityComparer<T>
    {
        private Func<T, T, bool> _func = null;
        public LambdaEqualityComparer(Func<T, T, bool> equals)
        {
            _func = equals;
        }

        public override bool Equals(T x, T y)
        {
            return _func(x, y);
        }

        public override int GetHashCode(T obj)
        {
            return obj.GetHashCode();
        }
    }
}